<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<!--导航部分-->
<header th:fragment="nav">
    <!--导航部分  begin-->
    <div class="container" style="margin-top: 5px;">
        <nav class="navbar navbar-default well-sm" style="padding-left: 0px;" role="navigation">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example-navbar-collapse">
                        <span class="sr-only">切换导航</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="#" th:href="@{/}">优客书城</a>
                </div>
                <div class="collapse navbar-collapse" id="example-navbar-collapse">
                    <ul class="nav navbar-nav pull-left">
                        <li class="active">
                            <a href="index.html" th:href="@{/}">首页</a>
                        </li>

                        <li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                图书类型
                                <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li>
                                    <a href="books_list.html" th:href="@{/book/bookList/{category}(category=1)}">精选图书</a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="books_list.html" th:href="@{/book/bookList/{category}(category=2)}">推荐图书</a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="books_list.html" th:href="@{/book/bookList/{category}(category=3)}">特价图书</a>
                                </li>
                                <li class="divider"></li>
                            </ul>
                        </li>
                        <li th:if="${session.user == null}">  <!--如果无用户 显示登录窗口-->
                            <a href="#" data-toggle="modal" data-target="#loginModal">登录</a>
                        </li>
                        <li th:if="${session.user != null}">
                            <a href="javascript:void(0)" th:text="'欢迎:'+${session.user.getUsername()}">谁登录了</a>
                        </li>
                        <li th:if="${session.user != null}"> <!--如果有用户 显示退出窗口-->
                            <a href="index.html" th:href="@{/user/logout}">安全退出</a>
                        </li>
                        <li th:if="${session.user == null}">
                            <a href="#" data-toggle="modal" data-target="#register">注册</a>
                        </li>
                        <li>
                            <a href="order_list.html" th:href="@{/order/list}">我的订单</a>
                        </li>
                        <li>
                            <a href="cart.html" th:href="@{/cart/list}"><span class="glyphicon glyphicon-shopping-cart"> </span>我的购物车</a>
                        </li>
                        <li>
                            <a href="collect_list.html" th:href="@{/favorites/list}"><span class="glyphicon "> </span>我的收藏</a>
                        </li>
                        <li>
                            <a th:text="${msg}" href="javascript:void(0)" style="color: red"></a>
                        </li>
                    </ul>
                    <div class="input-group col-md-3 pull-right" style="positon:relative;padding: 7px;">
                        <input type="text" class="form-control" id="bookName" name="bookName" placeholder="请输入图书名" />
                        <span class="input-group-btn">
					            <button class="btn btn-info btn-search" id="searchBook">
					            	<span class="glyphicon glyphicon-search"></span>
					            </button>
							</span>
                    </div>
                </div>
            </div>
        </nav>
    </div>
    <!--导航部分 end-->
</header>
</html>
